#include<iostream>
using namespace std;
int main()
{
	int x;
	bool flag = 0;
	int last = -1;
	for (int i = 1; i <= 8; i++) {
		cin >> x;
		if (x < last)flag = 1;
		if (x >= 100 && x <= 675) {
			if (x % 25 != 0) flag = 1;
		}
		else flag = 1;
		last = x;
	}
	if (flag)cout << "No" << endl;
	else cout << "Yes" << endl;
	return 0;
}